<template>
    <el-tabs v-model="global.currentTab" type="card" @tab-remove="removeTab" @tab-click="selectTab">
        <el-tab-pane
                v-for="(item) in global.tabList"
                :key="item.name"
                :label="item.title"
                :name="item.name"
                :closable=item.closable?false:true
        >
        <span slot="label"><i :class=item.icon></i> {{item.title}}</span>
        </el-tab-pane>
    </el-tabs>
</template>

<script>

    export default {
        data() {
            return {
                global: this.$global,
            }
        },
        methods: {
            removeTab(targetName) {
                this.$global.removeTab(targetName);
            },
            selectTab(tab) {
                this.$global.selectTab(tab);
            }
        }
    }
</script>